package com.htgd.gardenexpo.controller;


import com.htgd.gardenexpo.entity.CommonResult;
import com.htgd.gardenexpo.entity.GeConTheaterMovie;
import com.htgd.gardenexpo.entity.WxUserTheaterTicket;
import com.htgd.gardenexpo.service.IWxUserTheaterTicketService;
import com.htgd.gardenexpo.utils.TokenUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 微信用户剧场投票详情 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-10-22
 */
@RestController
@RequestMapping("/api/wxUserTheaterTicket")
@Api(tags = "微信用户剧场投票详情")
@Slf4j
public class WxUserTheaterTicketController {

    @Autowired
    private IWxUserTheaterTicketService wxUserTheaterTicketService;

    @PostMapping(value = "/add")
    @ApiOperation("添加")
    public CommonResult add(@RequestBody WxUserTheaterTicket wxUserTheaterTicket, HttpServletRequest request) {
        log.info("微信用户剧场投票：{}", wxUserTheaterTicket);
        String accessToken = request.getHeader("Access_token");
        String openId = TokenUtil.getUsernameFromToken(accessToken);
        return wxUserTheaterTicketService.add(openId,wxUserTheaterTicket);
    }

}
